// run: $exec < input
#include <cstdio>
#include <vector>

int n, ans;
std::vector<int> a;

bool trans(std::vector<int> & a)
{
	bool stable = true;
	std::vector<int> b = a;
	for (int i = 1; i < n - 1; i++) {
		b[i] = (a[i] + a[i-1] + a[i+1] >= 2);
		if (b[i] != a[i]) stable = false;
	}
	a = b;
	return stable;
}

int get(int x)
{
	int i = x + 1;
	for (; i < n; i++) if (a[i] != a[x]) break;
	return i - 1;
}

void solve(int pre, int now)
{
	if (now - pre == 1) return;
	if (a[pre] == a[now]) {
		ans = std::max(ans, (now - pre) / 2);
		for (int i = pre + 1; i < now; i++) a[i] = a[pre];
	} else {
		int tmp = (now - pre - 1) / 2;
		ans = std::max(ans, tmp);
		for (int i = 1; i <= tmp; i++) {
			a[pre + i] = a[pre];
			a[now - i] = a[now];
		}
	}
}

int main()
{
	std::scanf("%d", &n);
	a.resize(n);
	for (int i = 0; i < n; i++)
		std::scanf("%d", &a[i]);

	if (trans(a)) {
		std::printf("0\n");
		for (auto i : a) std::printf("%d ", i);
		std::printf("\n");
		return 0;
	}

	// ans = 1
	int pos = get(0);
	if (pos == 0) pos = -1;
	for (int i = pos + 1; i < n; i++) {
		int ti = get(i);
		if (ti == i) continue;
		if (pos != -1) solve(pos, i);
		pos = ti; i = ti;
	}
	std::printf("%d\n", ans + 1);
	for (auto i : a) std::printf("%d ", i);
	std::printf("\n");
}

